package com.example.jd.finance.entity;

import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.example.jd.common.DateUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.io.Serializable;

/**
 * <p>
 *
 * </p>
 *
 * @author admin
 * @since 2021-11-06
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class MsWechatIncreaseCustomerDetails extends Model<MsWechatIncreaseCustomerDetails> {

    private static final long serialVersionUID = 1L;

    private Long id;

    private Long bid;

    /**
     * 企业微信号
     */
    private String enterpriseWechatCode;

    /**
     * 客户数据bid
     */
    private Long customerBid;

    /**
     * 1-已申请，2-申请通过，3-申请失败，4-用户不存在，5-已接触 6-未添加
     */
    private Integer state;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;

    /**
     * 申请时间时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime applyTime;

    /**
     * 申请详情
     */
    private String applyDesc;

    public static MsWechatIncreaseCustomerDetails generateMsWechatIncreaseCustomerDetails(Long bid, String enterpriseWechatCode,
                                                                                   Long customerBid, Integer state, String applyDesc,
                                                                                          String applyTime) {
        return MsWechatIncreaseCustomerDetails.builder()
                .bid(bid)
                .enterpriseWechatCode(enterpriseWechatCode)
                .customerBid(customerBid)
                .state(state)
                .applyDesc(applyDesc)
                .createTime(LocalDateTime.now())
                .applyTime(DateUtils.stringToLocalDate(applyTime))
                .build();
    }


}
